package com.inspur.encache.startup;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Test {

    public static void main(String[] args) {
        // 手动注册一个配置类，无需在类上加Configuration或service注解
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.register(CachingConfig.class);
        ctx.register(BookService.class);
        ctx.refresh();

        BookService book = ctx.getBean(BookService.class);
        System.out.println(book.getBook(1));
        System.out.println(book.getBook(1));
        System.out.println(book.getBook(1));
        System.out.println(book.getBook(1));
        System.out.println(book.getBook(2));
        ctx.close();
    }
}